package test.serverframe.armc.server.manager.dao.mapper;

import org.apache.ibatis.jdbc.SQL;
import test.serverframe.armc.server.manager.domain.InvokeTaskRecord;

public class InvokeTaskRecordSqlProvider {

    public String insertSelective(InvokeTaskRecord record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("tb_ssgp_invoke_task_record");
        
        if (record.getInvokeTaskRecordId() != null) {
            sql.VALUES("invoke_task_record_id", "#{invokeTaskRecordId,jdbcType=VARCHAR}");
        }
        
        if (record.getInvokeRecordId() != null) {
            sql.VALUES("invoke_record_id", "#{invokeRecordId,jdbcType=VARCHAR}");
        }
        
        if (record.getStatus() != null) {
            sql.VALUES("status", "#{status,jdbcType=BIT}");
        }
        
        if (record.getInterfaceTotal() != null) {
            sql.VALUES("interface_total", "#{interfaceTotal,jdbcType=VARCHAR}");
        }
        
        if (record.getInterfaceSuccessTotal() != null) {
            sql.VALUES("interface_success_total", "#{interfaceSuccessTotal,jdbcType=VARCHAR}");
        }
        
        if (record.getTaskGroupId() != null) {
            sql.VALUES("task_group_id", "#{taskGroupId,jdbcType=VARCHAR}");
        }
        
        if (record.getVersion() != null) {
            sql.VALUES("version", "#{version,jdbcType=TIMESTAMP}");
        }
        
        if (record.getStartTime() != null) {
        	sql.VALUES("start_time", "#{startTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getEndTime() != null) {
        	sql.VALUES("end_time", "#{endTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getNodeArr() != null) {
            sql.VALUES("node_arr", "#{nodeArr,jdbcType=VARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(InvokeTaskRecord record) {
        SQL sql = new SQL();
        sql.UPDATE("tb_ssgp_invoke_task_record");
        
        if (record.getInvokeRecordId() != null) {
            sql.SET("invoke_record_id = #{invokeRecordId,jdbcType=VARCHAR}");
        }
        
        if (record.getStatus() != null) {
            sql.SET("status = #{status,jdbcType=BIT}");
        }
        
        if (record.getInterfaceTotal() != null) {
            sql.SET("interface_total = #{interfaceTotal,jdbcType=VARCHAR}");
        }
        
        if (record.getInterfaceSuccessTotal() != null) {
            sql.SET("interface_success_total = #{interfaceSuccessTotal,jdbcType=VARCHAR}");
        }
        
        if (record.getTaskGroupId() != null) {
            sql.SET("task_group_id = #{taskGroupId,jdbcType=VARCHAR}");
        }
        
        if (record.getVersion() != null) {
            sql.SET("version = #{version,jdbcType=TIMESTAMP}");
        }
        
        if (record.getStartTime() != null) {
        	sql.SET("start_time = #{startTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getEndTime() != null) {
        	sql.SET("end_time = #{endTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getNodeArr() != null) {
            sql.SET("node_arr = #{nodeArr,jdbcType=VARCHAR}");
        }
        
        sql.WHERE("invoke_task_record_id = #{invokeTaskRecordId,jdbcType=VARCHAR}");
        
        return sql.toString();
    }


}